dao = function(name, action, param, on_success, on_error, extra_on_success) {
  var path = '/dao?name=' + name + '&action=' + action;
  if (param) {
    path += '&' + param;
  }
  //alert(path)
  var xhr = new XMLHttpRequest();
  xhr.onreadystatechange = function() {
    if (xhr.readyState != 4) {
      return;
    }
    //alert(xhr.responseText);
    if (xhr.status == 200) {
      if (on_success) {
        on_success(xhr.responseText);
      }
      if (extra_on_success) {
        extra_on_success(xhr.responseText);
      }
    } else if (on_error) {
      on_error(xhr.responseText)
    }
  };

  xhr.open('GET', path, true);
  xhr.send();
};

report_success = function() {
  alert('Done.');
}

on_enter = function(e, func) {
  if (e.keyCode == 13) {
    func();
    return false;
  }
  return true;
}

noop = function() {}
